;; Testing i64 rotates

(module
  (func $dummy)

  (func (export "rotl") (param $0 i64) (param $1 i64) (param $2 i64) (result i32)
    (i64.eq (i64.rotl (local.get $0) (local.get $1)) (local.get $2)))
  (func (export "rotr") (param $0 i64) (param $1 i64) (param $2 i64) (result i32)
    (i64.eq (i64.rotr (local.get $0) (local.get $1)) (local.get $2)))
)

(assert_return (invoke "rotl" (i32.const 0) (i32.const 0)
                              (i32.const 0) (i32.const 0)
                              (i32.const 0) (i32.const 0))
               (i32.const 1))
(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
                              (i32.const 1) (i32.const 0)
                              (i32.const 2) (i32.const 0))
               (i32.const 1))
(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
                              (i32.const 31) (i32.const 0)
                              (i32.const 2147483648) (i32.const 0))
               (i32.const 1))
(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
                              (i32.const 32) (i32.const 0)
                              (i32.const 0) (i32.const 1))
               (i32.const 1))
(assert_return (invoke "rotl" (i32.const 1) (i32.const 0)
                              (i32.const 33) (i32.const 0)
                              (i32.const 0) (i32.const 2))
               (i32.const 1))

(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
                              (i32.const 1) (i32.const 0)
                              (i32.const 2) (i32.const 2))
               (i32.const 1))
(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
                              (i32.const 31) (i32.const 0)
                              (i32.const 2147483648) (i32.const 2147483648))
               (i32.const 1))
(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
                              (i32.const 32) (i32.const 0)
                              (i32.const 1) (i32.const 1))
               (i32.const 1))
(assert_return (invoke "rotl" (i32.const 1) (i32.const 1)
                              (i32.const 33) (i32.const 0)
                              (i32.const 2) (i32.const 2))
               (i32.const 1))


(assert_return (invoke "rotr" (i32.const 0) (i32.const 0)
                              (i32.const 0) (i32.const 0)
                              (i32.const 0) (i32.const 0))
               (i32.const 1))
(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
                              (i32.const 1) (i32.const 0)
                              (i32.const 0) (i32.const 2147483648))
               (i32.const 1))
(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
                              (i32.const 31) (i32.const 0)
                              (i32.const 0) (i32.const 2))
               (i32.const 1))
(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
                              (i32.const 32) (i32.const 0)
                              (i32.const 0) (i32.const 1))
               (i32.const 1))
(assert_return (invoke "rotr" (i32.const 1) (i32.const 0)
                              (i32.const 33) (i32.const 0)
                              (i32.const 2147483648) (i32.const 0))
               (i32.const 1))
